#ifndef GULLENGINE_SCENENODE_H
#define GULLENGINE_SCENENODE_H

#include "ISceneNode.h"
#include "NodeController.h"
#include <map>
#include <iostream>

namespace gull{
    namespace core{    
        
		typedef std::map<unsigned short, NodeController*> controllersMap;
		typedef std::pair<unsigned short, NodeController*> controllerPair;
		
        class SceneNode:  public ISceneNode
        {
        public:
            SceneNode(const char* name, renderPass);
			SceneNode(const SceneNode& node);
            ~SceneNode();
            
            virtual gullNotification update(Scene* scene);
            virtual gullNotification preRender(Scene* scene);
            virtual gullNotification render(Scene* scene);
            virtual gullNotification postRender(Scene* scene);
			
			inline NodeController* getController(unsigned short ctrl);
			inline const NodeController* getController(unsigned short ctrl) const;
			
			void setController(unsigned short ctrl, NodeController* nodeCtrl);

			
        protected:
			controllersMap m_controllers;
        private:
        };
		
		
		NodeController*
		SceneNode::getController(unsigned short ctrl)
		{
			return m_controllers[ctrl];
		}
		
		const NodeController*
		SceneNode::getController(unsigned short ctrl) const
		{
			return m_controllers.find(ctrl)->second;
		}
		
		
        
    }
}
#endif